package leetcode.Y2024M6.study;

import leetcode.Y2024M6.TreeNode;
import org.junit.Test;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

public class S222 {

    public int countNodes(TreeNode root) {
        if (root == null) return 0;
        return 1 + countNodes(root.left) + countNodes(root.right);
    }

    @Test
    public void test() {
        int[] root = {1, 2, 3, 4, 5, 6};
        TreeNode tree = TreeNode.createTree(root);
        System.out.println(countNodes(tree));
    }
}
